﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GameCode.Models.PhoneApp
{
    public class GameModel:LayoutModel
    {
        public Guid ID { get; set; }
        public string LogoLink { get; set; }
        public string GameName { get; set; }
        public string GameDescription { get; set; }
        public string WebSite { get; set; }

        public string RightName { get; set; }
        public string OpenDate { get; set; }

        public int RemainCodes { get; set; }
        public int TotalCodes { get; set; }

        public string StrRate {
            get 
            {
                if (Rate == 0)
                    return "width: 0%;display:none";
                else if (Rate < 8)
                {
                    return "width: 8%";
                }
                else
                    return string.Format("width: {0}%", Rate);
            }
        }
        public int Rate
        {
            get
            {
                if (TotalCodes == 0)
                {
                    return 0;
                }
                return RemainCodes * 100 / TotalCodes;
            }
        }

        public string Code { get; set; }

        public string GiftContent { get; set; }
    }
}